package org.yelongframework.servlet.http;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Cookie支持
 * 
 * @since 1.0.0
 */
public interface CookieSupport {

	/**
	 * 获取cookie
	 * 
	 * @param request request
	 * @param name    cookie name
	 * @return cookie value
	 */
	String getCookie(HttpServletRequest request, String name);

	/**
	 * 添加cookie
	 * 
	 * @param response response
	 * @param name     cookie name
	 * @param value    cookie value
	 */
	void addCookie(HttpServletResponse response, String name, String value);

	/**
	 * 移除 cookie
	 * 
	 * @param response 响应
	 * @param name     cookie name
	 */
	void removeCookie(HttpServletResponse response, String name);

	/**
	 * 清空cookie 将request中的所有cookie清除
	 * 
	 * @param request  request
	 * @param response response
	 */
	void clearCookie(HttpServletRequest request, HttpServletResponse response);

}
